package com.harry.resource.workflow.entity;

import javax.persistence.*;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import com.harry.basis.BasePoEntity;
import static com.harry.configuration.ConstSettings.*;
import lombok.*;
import java.util.Set;

@Getter
@Setter
@Entity
public class WorkStateDefinition extends BasePoEntity {

	private static final long serialVersionUID = 1L;

	@Column(length = MEDIUM_LENGTH, nullable = false)
	String name;

	@Fetch(FetchMode.JOIN)
	@OneToMany(cascade = CascadeType.REMOVE, fetch = FetchType.EAGER)
	@JoinColumn
	private Set<WorkRoute> sourceRoutes;

	@Fetch(FetchMode.JOIN)
	@OneToMany(cascade = CascadeType.REMOVE, fetch = FetchType.LAZY)
	@JoinColumn
	private Set<WorkStatePropDefinition> statePropDefinitions;

	@Fetch(FetchMode.JOIN)
	@OneToMany(cascade = CascadeType.REMOVE, fetch = FetchType.LAZY)
	@JoinColumn
	private Set<WorkActivityDefinition> activityDefinitions;

	@Column
	private String comments;
}
